package com.jungle.bfi.generator.config;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;

@EqualsAndHashCode(callSuper = true)
@Data
@NoArgsConstructor
@AllArgsConstructor
public class OutputCfg extends PositionCfg {
    /**
     * 基本包路径
     */
    private String basePackage;
    /**
     * 功能包路径
     */
    private String subPackage;
    /**
     * 文件后缀
     */
    private String suffix;
    /**
     * 模型名称(模型中的数据)
     */
    private String model;

    private String charset;

    public Charset charset() {
        if (charset == null) {
            return StandardCharsets.UTF_8;
        }
        try {
            return Charset.forName(charset);
        } catch (Exception e) {
            return StandardCharsets.UTF_8;
        }
    }
}
